<template>
	<view>
		<sww-nav-bar :title="title"></sww-nav-bar>
		<article-detail v-if="articleId > 0" :articleId="articleId" :istab="true" @loadFinshed="loadFinshed"></article-detail>
	</view>
</template>

<script>
	import articleDetail from '@/pagecomponents/articleDetail/index.vue'
	import { mapState } from 'vuex';
	export default {
		components:{
			'article-detail':articleDetail
		},
		props:{
			tabIndex:{
				type:Number,
				default:0
			}
		},
		data () {
			return {
				title:'',
				articleId:null
			}
		},
		computed:{
			...mapState(['vuex_tab_bar'])
		},
		methods:{
			$onLoad() {
				let query = this.vuex_tab_bar.list[this.tabIndex].query
				if(query.id){
					this.articleId = query.id
				}
				if(query.title){
					this.title = query.title
				}
			},
			loadFinshed (item) {
				if(!this.title){
					this.title = item.name
				}
			}
		}
	}
</script>

<style>
	page{
		background-color: #fff;
	}
</style>
